<?
	$reports = Core_ModuleManager::listReports();
	$first_header = true;
	$current_module_id = strtolower(Phpr::$router->param('module'));
	foreach ($reports as $module_id=>$module_reports):
		if (!count($module_reports['reports']))
			continue;
			
		$last = count($module_reports['reports'])-1;
		$index = 0;
		$currentReport = $this->viewDataElement('report');
?>

	<h3 <? if ($first_header): ?>class="round"<? endif ?>>
		<?= h($module_reports['name']) ?>
		<? if ($first_header): ?>
			<span class="lt">&#160;</span>
			<span class="rt">&#160;</span>
		<? endif ?>
	</h3>
	<div class="clear"></div>
	
	<ul class="sidebar-selector">
		<? foreach($module_reports['reports'] as $id=>$report): ?>
			<li class="<?= $index == $last ? 'last' : null ?> <?= $currentReport == $id && $current_module_id == $module_id ? 'current' : null ?>" ><div><a href="<?= url($module_id.'/'.$id.'_report').'?'.uniqid() ?>"><?= h($report) ?></a></div></li>
		<? 
			$index++;
			endforeach ?>
	</ul>

<? 
	$first_header = false;
	endforeach ?>